package com.hkw.service.impl;
import com.hkw.dao.IUserDao;
import com.hkw.factory.UserDaoFactory;
import com.hkw.model.User;
import com.hkw.service.IUserService;
import java.sql.SQLException;

/**
 * user接口服务类的实现类
 */
public class UserServiceImpl implements IUserService {
    private IUserDao userDao;
    public UserServiceImpl() {
        this.userDao = UserDaoFactory.getUserDao();
    }

    /**
     * 登入方法
     * @param user
     * @return
     */
    @Override
    public int login(User user) {
        try {
            return userDao.findByNameAndPassword(user);
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        return -1;
    }
}
